package com.only4play.practice.ordercommon.pay;



import com.only4play.codegen.support.constants.BaseEnum;

import java.util.Optional;

/**
 * @author mengdy
 */

public enum PayChannelType implements BaseEnum<PayChannelType> {

  WECHAT(1, "微信支付"),
  ALIPAY(2,"支付宝"),
  COIN(3,"虚拟币"),
  ACTIVITY(4,"活动")
  ;

  PayChannelType(Integer code, String name) {
    this.code = code;
    this.name = name;
  }

  private Integer code;
  private String name;

  @Override
  public Integer getCode() {
    return this.code;
  }

  @Override
  public String getName() {
    return this.name;
  }

  public static Optional<PayChannelType> of(Integer code) {
    return Optional.ofNullable(BaseEnum.parseByCode(PayChannelType.class, code));
  }

}